<%@ taglib uri="/WEB-INF/struts-bean" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic" prefix="logic"%>

<html:form action="/sistema/venda/modificar" method="post" focus="dataVenda">
	<table class="tbForm">
		<logic:messagesPresent message="false">
		<tr>
			<td colspan="2" class="erro">
				<bean:message key="formulario.informar.erros"/>
			</td>
		</tr>
		<tr>
			<td colspan="2" class="erro">
				<html:messages id="mensagem" message="false" property="falha">
					<bean:write name="mensagem"/>
				</html:messages>
			</td>
		</tr>
		</logic:messagesPresent>
		
		<tr>
			<td valign="top" align="right"><bean:message key="formulario.venda.dataVenda"/>:</td>
			<td align="left">
				<html:text property="dataVenda" size="12" maxlength="10"/> <html:img pageKey="sistema.ico.calendario" onclick="displayCalendar(document.forms[0].dataCompra,'dd/mm/yyyy',this)"/>
				<html:img pageKey="sistema.ico.dica" onclick="abrirJanelaDica('venda/dataVenda.htm')"/>
				<logic:messagesPresent message="false">
					<html:messages id="mensagem" message="false" property="dataCompra">
						<br><span class="erro"><bean:write name="mensagem"/></span>
					</html:messages>
				</logic:messagesPresent>
			</td>
		</tr>
		<tr>
			<td align="right" valign="top" ><bean:message key="formulario.venda.cliente"/>:</td>
			<td align="left">
				<html:select property="clienteId">
					<html:option value="" />
					<html:options collection="clientes" labelProperty="nome" property="clienteId" />
				</html:select>
				<html:img pageKey="sistema.ico.dica" onclick="abrirJanelaDica(venda/cliente.htm')"/>
				<logic:messagesPresent message="false">
					<html:messages id="mensagem" message="false" property="clienteId">
						<br><span class="erro"><bean:write name="mensagem"/></span>
					</html:messages>
				</logic:messagesPresent>
			</td>
		</tr>
		<tr>
			<td align="right" valign="top" ><bean:message key="formulario.venda.usuario"/>:</td>
			<td align="left">
				<html:select property="usuarioLogin">
					<html:option value="" />
					<html:options collection="usuarios" labelProperty="nome" property="usuarioLogin" />
				</html:select>
				<html:img pageKey="sistema.ico.dica" onclick="abrirJanelaDica(venda/usuario.htm')"/>
				<logic:messagesPresent message="false">
					<html:messages id="mensagem" message="false" property="usuarioLogin">
						<br><span class="erro"><bean:write name="mensagem"/></span>
					</html:messages>
				</logic:messagesPresent>
			</td>
		</tr>		
		<tr>
			<td align="right" valign="top" ><bean:message key="formulario.venda.itens"/>:</td>
			<td align="left">
				<html:link action="/sistema/venda/item/listar" paramId="vendaId" paramName="venda" paramProperty="vendaId">
					<bean:message key="menu.vendas.visualizaritens"/>
				</html:link>
				<html:img pageKey="sistema.ico.dica" onclick="abrirJanelaDica('venda/visualizar-itens.htm')"/>
			</td>
		</tr>
		<tr>
			<td align="right" valign="top" ><bean:message key="formulario.venda.finalizada"/>:</td>
			<td align="left">
				<logic:equal name="venda" property="finalizada" value="true"><bean:message key="mensagem.sim"/></logic:equal>
				<logic:equal name="venda" property="finalizada" value="false">
					<bean:message key="mensagem.nao"/>.
					<html:link action="/sistema/venda/item/listar" paramId="vendaId" paramName="venda" paramProperty="vendaId">
						<bean:message key="formulario.venda.finalizar"/>
					</html:link>
				</logic:equal>
			</td>
		</tr>
		<tr>
			<td>
				<html:hidden property="vendaId"/>
			</td>
			<td align="left">
				<html:submit><bean:message key="sistema.botao.salvar"/></html:submit>
			</td>
		</tr>
	</table>
</html:form>